*Table A.23: Baseline self-reported food preferences
cd ""

use "master_data_adults_child_s13456_shared.dta", clear

drop meal_control snack_control
gen meal_control=1 if treatment==2
replace meal_control=0 if treatment==1
tab meal_control

gen snack_control=1 if treatment==3
replace snack_control=0 if treatment==1
tab snack_control

drop if type_id=="X" // **Dropping newborns born during the three years of study
drop if id=="3885553B" //**error in the id number and empty data
drop if id=="3885553G" //**error in the id number and empty data
replace treatment=2 if id=="38855553B" //**retrieving the correct treatment for this id
replace treatment=2 if id=="38855553G" //**retrieving the correct treatment for this id
drop if id=="101aa22c" //**this id does not exist
drop if id=="27655663" //**outlier on many measurements

***children***
//by category//
**children
eststo clear
bys treatment  :  eststo :  qui estpost sum fp_sweets fp_bread fp_processed fp_fruit fp_cheese fp_meat_fish_egg fp_veg meal_tunapasta meal_omelette meal_bakedpotato meal_turkey meal_salmon if child==1 & session==1
*esttab using "food_pref_catego_child.xls", cells("mean(fmt(1)) sd(fmt(1))  count(fmt(0))") tab label collabels("Mean" "Std. Dev." "N")   addnotes("")  nonumber noobs replace
foreach v of var  fp_sweets fp_bread fp_processed fp_fruit fp_cheese fp_meat_fish_egg fp_veg meal_tunapasta meal_omelette meal_bakedpotato meal_turkey meal_salmon {
ttest `v' if child==1 & session==1, by(meal_control) 
ttest `v' if child==1 & session==1, by(snack_control) 
}

**adults
eststo clear
bys treatment  :  eststo :  qui estpost sum fp_sweets fp_bread fp_processed fp_fruit fp_cheese fp_meat_fish_egg fp_veg meal_tunapasta meal_omelette meal_bakedpotato meal_turkey meal_salmon if child==0 & session==1
*esttab using "food_pref_catego_adults.xls", cells("mean(fmt(1)) sd(fmt(1))  count(fmt(0))") tab label collabels("Mean" "Std. Dev." "N")   addnotes("")  nonumber noobs replace
foreach v of var fp_fruit fp_meat_fish_egg fp_cheese fp_veg fp_bread fp_processed fp_sweets   meal_turkey meal_salmon  meal_omelette meal_tunapasta  meal_bakedpotato   {
ttest `v' if child==0 & session==1, by(meal_control) 
ttest `v' if child==0 & session==1, by(snack_control) 
}
